package com.sky.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.sky.dto.BackstageTagQueryDTO;
import com.sky.mapper.BackstageTagMapper;
import com.sky.result.PageResult;
import com.sky.service.BackstageTagService;
import com.sky.vo.AnnouncementsVO;
import com.sky.vo.BackstageTagVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
  * @author 贾晓晨
  * @version 1.0
*/
@Service
public class BackstageTagServiceImp implements BackstageTagService {
    @Autowired
    private BackstageTagMapper backstageTagMapper;

    @Override
    public List<BackstageTagVO> getTagList(String tag) {
             List<BackstageTagVO> backstageTagVOList = backstageTagMapper.getAllTag(tag);
            return backstageTagVOList;
    }

    @Override
    public PageResult getTag(BackstageTagQueryDTO backstageTagQueryDTO) {
        PageHelper.startPage(backstageTagQueryDTO.getPage(), backstageTagQueryDTO.getPageSize());
        Page<BackstageTagVO> articleList = backstageTagMapper.getTag(backstageTagQueryDTO);
        long total = articleList.getTotal();
        List records = articleList.getResult();
        return new PageResult(total,records);
    }

    @Override
    public void deleteTag(List<Integer> ids) {
        backstageTagMapper.deleteTag(ids);
    }

    // @Override
    // public List<BackstageTagVO> getTagList(String tagName) {
    //      List<BackstageTagVO> backstageTagVOList = backstageTagMapper.getAllTag(tagName);
    //     return backstageTagVOList;
    // }
}
